package cn.lili.modules.grab.xdxt.config;

import com.schl.api.enums.DomainEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;

@Component
@Data
@RefreshScope
public class XdxtConfig {

    @ApiModelProperty("请求appid")
    @Value("${xdxt.appid:488378-k7H9r7C2ivjwi0Ud}")
    private String appid;

    @ApiModelProperty("请求secret")
    @Value("${xdxt.secret:fbxLp5RHO2p4p15yzpz4VvndSE9D0A3P}")
    private String secret;

    @ApiModelProperty("请求url")
    @Value("${xdxt.urltype:dev}")
    private String urltype;

    /**
     * 获取请求地址
     */
    public DomainEnum getUrl() {
        if ("prd".equals(urltype)) {
            return DomainEnum.PRODUCTION;
        }
        return DomainEnum.TESTING;
    }
}
